<template>
<div>
  <h1>演员展示</h1>
  <table border="1" cellspacing="0" align="center">
    <tr>
      <td>演员姓名</td>
      <td @click="bian(type)">演员年龄</td>
      <td>演员性别</td>
    </tr>
    <tr v-for="i in peoplelist">
      <td>{{i.name}}</td>
      <td>{{i.age}}</td>
      <td>{{i.gender}}</td>
    </tr>
  </table>
</div>
</template>

<script>
export default {
  name: "move",
  data(){
    return{
      peoplelist:[],
      type:1
    }
  },
  methods:{
    get_peo(){
      this.$axios.get('users/PeoAPI/')
      .then(res=>{
        this.peoplelist = res.data.list
      })
    },
    bian(type){
      this.$axios.put('users/PeoAPI/?type='+type)
      .then(res=>{
        this.type = res.data.type
        this.peoplelist = res.data.list
      })
    }
  },
  mounted() {
    this.get_peo()
  }
}
</script>

<style scoped>

</style>
